import http from './http'


async function getVideoListAllData(userId) {
    try {
        const response = await http({
            method: 'get',
            url: '/getAllVideoList/' + userId,
        })
        return response.data
    } catch (error) {
        console.log(error);
    }
}

async function getVideoByVideoId(userId, videoId) {
    try {
        const response = await http({
            method: 'get',
            url: '/getVideo',
            params: {
                userId: userId,
                videoId: videoId
            }
        })
        return response.data
    } catch (error) {
        console.log(error);
    }
}

async function addVideoDanmu(userId, videoId, danmuData) {
    try {
        //console.log("这是添加弹幕数据收到的全部数据",userId, videoId, danmuData);
        const response = await http({
            method: "post",
            url: "/addDanmu",
            data: {
                userId: userId,
                videoId: videoId,
                text: danmuData.text,
                mode: danmuData.mode,
                color: danmuData.color,
                border: danmuData.border,
                time: danmuData.time,
            }
        })
        return response;
    } catch (error) {
        console.log(error);
    }
}

export default { getVideoListAllData, getVideoByVideoId,addVideoDanmu }